var windowName = "userInfo";
apiready = function(){
    onWindowShow(function () {
        // getInfo(Page)
    })
    onWindowHide(function () {
    })
    console.log("index page is OK");
    var PicUpUserHead = new PicUp()
    var Page = createVM("#Page",{
        //页面数据
        picUserHead:picUserHead
        ,headPic:picUserHead
        ,picV:baseUrl + picUserHead,
        user:{
            id:"0",
            nickName:"聪明学用户",
            phone:"0",
            grade:"a"

        },
        form: {
            nickName: '聪明学用户'
            ,headPic:picUserHead
            ,picV:baseUrl + picUserHead
        }
        ,loading:0
        ,pics:[]
        ,toolsShow:false
    },{
        //页面方法
        "init":function () {
            Page.userInfo = getLocData("userInfo")
            var data = getData4Page()
            logJson(data)
            this.user = data
        }
        ,selectEditPic:function () {
            var _this = this;
            PicUpUserHead.selectEdit(()=>{_this.toolsShow = true})
                .setCbFunc(function (pics) {
                    _this.form.headPic = pics[0]
                    _this.form.picV = PicUpUserHead.getViewData(pics)[0]
                })
        }
        ,save:function () {
            PicUpUserHead.editSave()
            this.toolsShow = false
        }
        ,reset:PicUpUserHead.editReset
        ,close:function () {
            PicUpUserHead.editClose()
            this.toolsShow = false
        }


    })
    Page.init()
}
function getInfo(_this) {
    apiGet("/app/user/home",{},function (res,code) {
        logJson(res.data,"/app/user/home")
        setLocData("userInfo",res.data)
        Page.shop = res.data;
        ProductPics.uploadedPath = Page.shop.pics
        Page.pics = ProductPics.getViewData()
    })
}


